<commit_before># This module provides an interface to the vips image processing library
# via ruby-ffi.
#
# Author::    <NAME>  (mailto:<EMAIL>)
# License::   MIT

require 'ffi'

module Vips
    private

    attach_function :vips_image_new_matrix_from_array, 
        [:int, :int, :pointer, :int], :pointer

    attach_function :vips_image_copy_memory, [:pointer], :pointer

    attach_function :vips_filename_get_filename, [:string], :string
    attach_function :vips_filename_get_options, [:string], :string

    attach_function :vips_foreign_find_load, [:string], :string
    attach_function :vips_foreign_find_save, [:string], :string
    attach_function :vips_foreign_find_load_buffer, [:pointer, :size_t], :string
    attach_function :vips_foreign_find_save_buffer, [:string], :string

    attach_function :vips_image_write_to_memory, 
        [:pointer, SizeStruct.ptr], :pointer

    attach_function :vips_image_get_typeof, [:pointer, :string], :GType
    attach_function :vips_image_get, 
        [:pointer, :string, GObject::GValue.ptr], :int

    # vips_image_get_fields was added in libvips 8.5
    begin
        attach_function :vips_image_get_fields, [:pointer], :pointer
    rescue FFI::NotFoundError
    end

    attach_function :vips_addalpha, [:pointer, :pointer, :varargs], :int
    attach_function :vips_image_hasalpha, [:pointer], :int

    attach_function :vips_image_set,
        [:pointer, :string, GObject::GValue.ptr], :void
    attach_function :vips_image_remove, [:pointer, :string], :void

    attach_function :vips_band_format_iscomplex, [:int], :int
    attach_function :vips_band_format_isfloat, [:int], :int

    attach_function :nickname_find, :vips_nickname_find, [:GType], :string

    public<commit_msg>Only bind vips_addalpha on libvips >= 8.6<commit_after># This module provides an interface to the vips image processing library
# via ruby-ffi.
#
# Author::    <NAME>  (mailto:<EMAIL>)
# License::   MIT

require 'ffi'

module Vips
    private

    attach_function :vips_image_new_matrix_from_array, 
        [:int, :int, :pointer, :int], :pointer

    attach_function :vips_image_copy_memory, [:pointer], :pointer

    attach_function :vips_filename_get_filename, [:string], :string
    attach_function :vips_filename_get_options, [:string], :string

    attach_function :vips_foreign_find_load, [:string], :string
    attach_function :vips_foreign_find_save, [:string], :string
    attach_function :vips_foreign_find_load_buffer, [:pointer, :size_t], :string
    attach_function :vips_foreign_find_save_buffer, [:string], :string

    attach_function :vips_image_write_to_memory, 
        [:pointer, SizeStruct.ptr], :pointer

    attach_function :vips_image_get_typeof, [:pointer, :string], :GType
    attach_function :vips_image_get, 
        [:pointer, :string, GObject::GValue.ptr], :int

    # vips_image_get_fields was added in libvips 8.5
    begin
        attach_function :vips_image_get_fields, [:pointer], :pointer
    rescue FFI::NotFoundError
    end

    # vips_addalpha was added in libvips 8.6
    if Vips::at_least_libvips?(8, 6)
        attach_function :vips_addalpha, [:pointer, :pointer, :varargs], :int
    end
    attach_function :vips_image_hasalpha, [:pointer], :int

    attach_function :vips_image_set,
        [:pointer, :string, GObject::GValue.ptr], :void
    attach_function :vips_image_remove, [:pointer, :string], :void

    attach_function :vips_band_format_iscomplex, [:int], :int
    attach_function :vips_band_format_isfloat, [:int], :int

    attach_function :nickname_find, :vips_nickname_find, [:GType], :string

    public
{'fraction_non_alphanumeric': 0.10966129927817879, 'fraction_numerical': 0.00277623542476402, 'mean_word_length': 4.774038461538462, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '719242', 'n_tokens_mistral': 1251, 'n_tokens_neox': 1199, 'n_words': 264}