Created
August 28, 2012 05:41
-
-
Save headius/3495252 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
system ~/projects/talkfilters-2.3.8 $ cat talkfilters_ffi.rb | |
require 'ffi' | |
module TalkFilters | |
extend FFI::Library | |
ffi_lib 'talkfilters' | |
attach_function :gtf_filter_pirate, [:string, :pointer, :uint], :int | |
def self.pirate(input) | |
ptr = FFI::MemoryPointer.new(:pointer, input.size * 2) | |
output = gtf_filter_pirate(input, ptr, input.size * 2) | |
ptr.read_string | |
end | |
end | |
p TalkFilters.pirate ARGV[0] | |
system ~/projects/talkfilters-2.3.8 $ jruby talkfilters_ffi.rb "The quick brown fox jumped over the lazy dog." | |
"Th' quick brown fox jumped o'er th' lazy dog. Pass the grog!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment