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

require 'ffi'

# This module uses FFI to make a simple layer over the glib and gobject 
# libraries. 

module GLib
    extend FFI::Library

    if FFI::Platform.windows?
        glib_libname = 'libglib-2.0-0.dll'
    else
        glib_libname = 'glib-2.0' 
    end

    ffi_lib glib_libname 

    # nil being the default
    glib_log_domain = nil

    def self.set_log_domain domain
        glib_log_domain = domain
    end

    attach_function :g_malloc, [:size_t], :pointer

    # save the FFI::Function that attach will return ... we can use it directly
    # as a param for callbacks
    G_FREE = attach_function :g_free, [:pointer], :void

end

module GObject
    extend FFI::Library

    if FFI::Platform.windows?
        gobject_libname = 'libgobject-2.0-0.dll'
    else
        gobject_libname = 'gobject-2.0'
    end

    ffi_lib gobject_libname

    # :gtype will usually be 64-bit, but will be 32-bit on 32-bit Windows
    typedef :ulong, :GType

    attach_function :g_type_name, [:GType], :string
    attach_function :g_type_from_name, [:string], :GType
    attach_function :g_type_fundamental, [:GType], :GType

    # look up some common gtypes
    GBOOL_TYPE = g_type_from_name "gboolean"
    GINT_TYPE = g_type_from_name "gint"<commit_msg>size gtype as uint32 on 32-bit machines<commit_after># This module provides an interface to the vips image processing library
# via ruby-ffi.
#
# Author::    <NAME>  (mailto:<EMAIL>)
# License::   MIT

require 'ffi'

# This module uses FFI to make a simple layer over the glib and gobject 
# libraries. 

module GLib
    extend FFI::Library

    if FFI::Platform.windows?
        glib_libname = 'libglib-2.0-0.dll'
    else
        glib_libname = 'glib-2.0' 
    end

    ffi_lib glib_libname 

    # nil being the default
    glib_log_domain = nil

    def self.set_log_domain domain
        glib_log_domain = domain
    end

    attach_function :g_malloc, [:size_t], :pointer

    # save the FFI::Function that attach will return ... we can use it directly
    # as a param for callbacks
    G_FREE = attach_function :g_free, [:pointer], :void

end

module GObject
    extend FFI::Library

    if FFI::Platform.windows?
        gobject_libname = 'libgobject-2.0-0.dll'
    else
        gobject_libname = 'gobject-2.0'
    end

    ffi_lib gobject_libname

    # we can't just use ulong, windows has different int sizing rules
    if FFI::Platform::ADDRESS_SIZE == 64
        typedef :uint64, :GType
    else
        typedef :uint32, :GType
    end

    attach_function :g_type_name, [:GType], :string
    attach_function :g_type_from_name, [:string], :GType
    attach_function :g_type_fundamental, [:GType], :GType

    # look up some common gtypes
    GBOOL_TYPE = g_type_from_name "gboolean"
    GINT_TYPE = g_type_from_name "gint"
{'fraction_non_alphanumeric': 0.08697123519458545, 'fraction_numerical': 0.012182741116751269, 'mean_word_length': 2.9571619812583667, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1587259', 'n_tokens_mistral': 1060, 'n_tokens_neox': 1011, 'n_words': 294}