Skip to content

Commit

Permalink
lexically sort all pkgcraft-c bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
radhermit committed Jun 16, 2024
1 parent 4c91443 commit 272a309
Show file tree
Hide file tree
Showing 13 changed files with 97 additions and 97 deletions.
4 changes: 2 additions & 2 deletions lib/pkgcraft/bindings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ module C
ffi_lib ["pkgcraft"]

# generic free support
attach_function :pkgcraft_str_free, [:pointer], :void
attach_function :pkgcraft_str_array_free, [:pointer, :size_t], :void
attach_function :pkgcraft_array_free, [:pointer, :size_t], :void
attach_function :pkgcraft_str_array_free, [:pointer, :size_t], :void
attach_function :pkgcraft_str_free, [:pointer], :void

# array length pointer for working with array return values
class LenPtr < FFI::Struct
Expand Down
6 changes: 3 additions & 3 deletions lib/pkgcraft/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ def self.release(ptr)
end
end

attach_function :pkgcraft_config_new, [], Config
attach_function :pkgcraft_config_add_repo, [Config, :repo, :bool], :repo
attach_function :pkgcraft_config_add_repo_path, [Config, :string, :int, :string, :bool], :repo
attach_function :pkgcraft_config_free, [:pointer], :void
attach_function :pkgcraft_config_load, [Config], :pointer
attach_function :pkgcraft_config_load_portage_conf, [Config, :string], :pointer
attach_function :pkgcraft_config_new, [], Config
attach_function :pkgcraft_config_repos, [Config, LenPtr.by_ref], :pointer
attach_function :pkgcraft_config_repos_set, [Config, :pointer], Pkgcraft::Repos::RepoSet
attach_function :pkgcraft_config_add_repo, [Config, :repo, :bool], :repo
attach_function :pkgcraft_config_add_repo_path, [Config, :string, :int, :string, :bool], :repo
end

# Config support
Expand Down
72 changes: 36 additions & 36 deletions lib/pkgcraft/dep.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,79 +50,79 @@ module Pkgcraft
# FFI bindings for Dep related functionality
module C
# cpn support
attach_function :pkgcraft_cpn_category, [Cpn], String
attach_function :pkgcraft_cpn_cmp, [Cpn, Cpn], :int
attach_function :pkgcraft_cpn_free, [:pointer], :void
attach_function :pkgcraft_cpn_hash, [Cpn], :uint64
attach_function :pkgcraft_cpn_new, [:string], Cpn
attach_function :pkgcraft_cpn_category, [Cpn], String
attach_function :pkgcraft_cpn_package, [Cpn], String
attach_function :pkgcraft_cpn_hash, [Cpn], :uint64
attach_function :pkgcraft_cpn_cmp, [Cpn, Cpn], :int
attach_function :pkgcraft_cpn_str, [Cpn], String

# cpv support
attach_function :pkgcraft_cpv_category, [Cpv], String
attach_function :pkgcraft_cpv_cmp, [Cpv, Cpv], :int
attach_function :pkgcraft_cpv_cpn, [Cpv], Pkgcraft::Dep::Cpn
attach_function :pkgcraft_cpv_free, [:pointer], :void
attach_function :pkgcraft_cpv_hash, [Cpv], :uint64
attach_function :pkgcraft_cpv_intersects, [Cpv, Cpv], :bool
attach_function :pkgcraft_cpv_intersects_dep, [Cpv, Dep], :bool
attach_function :pkgcraft_cpv_new, [:string], Cpv
attach_function :pkgcraft_cpv_category, [Cpv], String
attach_function :pkgcraft_cpv_package, [Cpv], String
attach_function :pkgcraft_cpv_version, [Cpv], Pkgcraft::Dep::Version
attach_function :pkgcraft_cpv_p, [Cpv], String
attach_function :pkgcraft_cpv_package, [Cpv], String
attach_function :pkgcraft_cpv_pf, [Cpv], String
attach_function :pkgcraft_cpv_pr, [Cpv], String
attach_function :pkgcraft_cpv_pv, [Cpv], String
attach_function :pkgcraft_cpv_pvr, [Cpv], String
attach_function :pkgcraft_cpv_cpn, [Cpv], Pkgcraft::Dep::Cpn
attach_function :pkgcraft_cpv_intersects, [Cpv, Cpv], :bool
attach_function :pkgcraft_cpv_intersects_dep, [Cpv, Dep], :bool
attach_function :pkgcraft_cpv_hash, [Cpv], :uint64
attach_function :pkgcraft_cpv_cmp, [Cpv, Cpv], :int
attach_function :pkgcraft_cpv_str, [Cpv], String
attach_function :pkgcraft_cpv_restrict, [Cpv], Restrict
attach_function :pkgcraft_cpv_str, [Cpv], String
attach_function :pkgcraft_cpv_version, [Cpv], Pkgcraft::Dep::Version

# dep support
attach_function :pkgcraft_dep_free, [:pointer], :void
attach_function :pkgcraft_dep_new, [:string, Eapi], Dep
attach_function :pkgcraft_dep_blocker, [Dep], :int
attach_function :pkgcraft_dep_blocker_from_str, [:string], :int
attach_function :pkgcraft_dep_category, [Dep], String
attach_function :pkgcraft_dep_package, [Dep], String
attach_function :pkgcraft_dep_version, [Dep], Pkgcraft::Dep::Version
attach_function :pkgcraft_dep_slot, [Dep], String
attach_function :pkgcraft_dep_subslot, [Dep], String
attach_function :pkgcraft_dep_slot_op, [Dep], :int
attach_function :pkgcraft_dep_slot_op_from_str, [:string], :int
attach_function :pkgcraft_dep_use_deps_str, [Dep, LenPtr.by_ref], :pointer
attach_function :pkgcraft_dep_repo, [Dep], String
attach_function :pkgcraft_dep_cmp, [Dep, Dep], :int
attach_function :pkgcraft_dep_cpn, [Dep], Pkgcraft::Dep::Cpn
attach_function :pkgcraft_dep_cpv, [Dep], String
attach_function :pkgcraft_dep_free, [:pointer], :void
attach_function :pkgcraft_dep_hash, [Dep], :uint64
attach_function :pkgcraft_dep_intersects, [Dep, Dep], :bool
attach_function :pkgcraft_dep_intersects_cpv, [Dep, Cpv], :bool
attach_function :pkgcraft_dep_new, [:string, Eapi], Dep
attach_function :pkgcraft_dep_p, [Dep], String
attach_function :pkgcraft_dep_package, [Dep], String
attach_function :pkgcraft_dep_parse, [:string, Eapi], :pointer
attach_function :pkgcraft_dep_pf, [Dep], String
attach_function :pkgcraft_dep_pr, [Dep], String
attach_function :pkgcraft_dep_pv, [Dep], String
attach_function :pkgcraft_dep_pvr, [Dep], String
attach_function :pkgcraft_dep_cpn, [Dep], Pkgcraft::Dep::Cpn
attach_function :pkgcraft_dep_cpv, [Dep], String
attach_function :pkgcraft_dep_intersects, [Dep, Dep], :bool
attach_function :pkgcraft_dep_intersects_cpv, [Dep, Cpv], :bool
attach_function :pkgcraft_dep_hash, [Dep], :uint64
attach_function :pkgcraft_dep_cmp, [Dep, Dep], :int
attach_function :pkgcraft_dep_str, [Dep], String
attach_function :pkgcraft_dep_repo, [Dep], String
attach_function :pkgcraft_dep_restrict, [Dep], Restrict
attach_function :pkgcraft_dep_parse, [:string, Eapi], :pointer
attach_function :pkgcraft_dep_slot, [Dep], String
attach_function :pkgcraft_dep_slot_op, [Dep], :int
attach_function :pkgcraft_dep_slot_op_from_str, [:string], :int
attach_function :pkgcraft_dep_str, [Dep], String
attach_function :pkgcraft_dep_subslot, [Dep], String
attach_function :pkgcraft_dep_use_deps_str, [Dep, LenPtr.by_ref], :pointer
attach_function :pkgcraft_dep_version, [Dep], Pkgcraft::Dep::Version

# version support
attach_function :pkgcraft_version_free, [:pointer], :void
attach_function :pkgcraft_version_new, [:string], Version
attach_function :pkgcraft_version_cmp, [Version, Version], :int
attach_function :pkgcraft_version_free, [:pointer], :void
attach_function :pkgcraft_version_hash, [Version], :uint64
attach_function :pkgcraft_version_intersects, [Version, Version], :bool
attach_function :pkgcraft_version_revision, [Version], Pkgcraft::Dep::Revision
attach_function :pkgcraft_version_new, [:string], Version
attach_function :pkgcraft_version_op, [Version], :int
attach_function :pkgcraft_version_op_from_str, [:string], :int
attach_function :pkgcraft_version_str, [Version], String
attach_function :pkgcraft_version_parse, [:string], :pointer
attach_function :pkgcraft_version_revision, [Version], Pkgcraft::Dep::Revision
attach_function :pkgcraft_version_str, [Version], String

# revision support
attach_function :pkgcraft_revision_free, [:pointer], :void
attach_function :pkgcraft_revision_new, [:string], Revision
attach_function :pkgcraft_revision_cmp, [Revision, Revision], :int
attach_function :pkgcraft_revision_free, [:pointer], :void
attach_function :pkgcraft_revision_hash, [Revision], :uint64
attach_function :pkgcraft_revision_new, [:string], Revision
attach_function :pkgcraft_revision_str, [Revision], String
end
end
26 changes: 13 additions & 13 deletions lib/pkgcraft/dep/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,37 +34,37 @@ def self.release(ptr)
# Dependency support
typedef Dependency.by_ref, :Dependency
attach_function :pkgcraft_dependency_cmp, [:Dependency, :Dependency], :int
attach_function :pkgcraft_dependency_hash, [:Dependency], :uint64
attach_function :pkgcraft_dependency_str, [:Dependency], String
attach_function :pkgcraft_dependency_parse, [:string, Eapi, :int], :Dependency
attach_function :pkgcraft_dependency_free, [:pointer], :void
attach_function :pkgcraft_dependency_hash, [:Dependency], :uint64
attach_function :pkgcraft_dependency_into_iter_flatten, [:Dependency], :pointer
attach_function :pkgcraft_dependency_into_iter_recursive, [:Dependency], :pointer
attach_function :pkgcraft_dependency_parse, [:string, Eapi, :int], :Dependency
attach_function :pkgcraft_dependency_str, [:Dependency], String

# DependencySet support
typedef DependencySet.by_ref, :DependencySet
attach_function :pkgcraft_dependency_set_eq, [:DependencySet, :DependencySet], :bool
attach_function :pkgcraft_dependency_set_hash, [:DependencySet], :uint64
attach_function :pkgcraft_dependency_set_str, [:DependencySet], String
attach_function :pkgcraft_dependency_set_len, [:DependencySet], :uint64
attach_function :pkgcraft_dependency_set_is_empty, [:DependencySet], :bool
attach_function :pkgcraft_dependency_set_parse, [:string, Eapi, :int], :DependencySet
attach_function :pkgcraft_dependency_set_free, [:pointer], :void
attach_function :pkgcraft_dependency_set_hash, [:DependencySet], :uint64
attach_function :pkgcraft_dependency_set_into_iter, [:DependencySet], :pointer
attach_function :pkgcraft_dependency_set_into_iter_next, [:pointer], :Dependency
attach_function :pkgcraft_dependency_set_into_iter_free, [:pointer], :void
attach_function :pkgcraft_dependency_set_into_iter_flatten, [:DependencySet], :pointer
attach_function :pkgcraft_dependency_set_into_iter_flatten_next, [:pointer], :pointer
attach_function :pkgcraft_dependency_set_into_iter_flatten_free, [:pointer], :void
attach_function :pkgcraft_dependency_set_into_iter_flatten_next, [:pointer], :pointer
attach_function :pkgcraft_dependency_set_into_iter_free, [:pointer], :void
attach_function :pkgcraft_dependency_set_into_iter_next, [:pointer], :Dependency
attach_function :pkgcraft_dependency_set_into_iter_recursive, [:DependencySet], :pointer
attach_function :pkgcraft_dependency_set_into_iter_recursive_next, [:pointer], :Dependency
attach_function :pkgcraft_dependency_set_into_iter_recursive_free, [:pointer], :void
attach_function :pkgcraft_dependency_set_into_iter_recursive_next, [:pointer], :Dependency
attach_function :pkgcraft_dependency_set_is_empty, [:DependencySet], :bool
attach_function :pkgcraft_dependency_set_len, [:DependencySet], :uint64
attach_function :pkgcraft_dependency_set_parse, [:string, Eapi, :int], :DependencySet
attach_function :pkgcraft_dependency_set_str, [:DependencySet], String

# Uri support
attach_function :pkgcraft_uri_filename, [Uri], String
attach_function :pkgcraft_uri_free, [:pointer], :void
attach_function :pkgcraft_uri_str, [Uri], String
attach_function :pkgcraft_uri_uri, [Uri], String
attach_function :pkgcraft_uri_free, [:pointer], :void
end

module Dep
Expand Down
4 changes: 2 additions & 2 deletions lib/pkgcraft/eapi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ def self.from_native(value, _context = nil)
typedef :pointer, :eapi_ptr
attach_function :pkgcraft_eapi_as_str, [:eapi_ptr], String
attach_function :pkgcraft_eapi_cmp, [Eapi, Eapi], :int
attach_function :pkgcraft_eapi_dep_keys, [:eapi_ptr, LenPtr.by_ref], :pointer
attach_function :pkgcraft_eapi_has, [Eapi, :string], :bool
attach_function :pkgcraft_eapi_hash, [:eapi_ptr], :uint64
attach_function :pkgcraft_eapi_dep_keys, [:eapi_ptr, LenPtr.by_ref], :pointer
attach_function :pkgcraft_eapis_official, [LenPtr.by_ref], :pointer
attach_function :pkgcraft_eapis, [LenPtr.by_ref], :pointer
attach_function :pkgcraft_eapis_official, [LenPtr.by_ref], :pointer
attach_function :pkgcraft_eapis_range, [:string, LenPtr.by_ref], :pointer
end

Expand Down
2 changes: 1 addition & 1 deletion lib/pkgcraft/error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def self.release(ptr)
end
end

attach_function :pkgcraft_error_last, [], Error.by_ref
attach_function :pkgcraft_error_free, [:pointer], :void
attach_function :pkgcraft_error_last, [], Error.by_ref
end

# Error support
Expand Down
2 changes: 1 addition & 1 deletion lib/pkgcraft/logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def self.release(ptr)
end

callback :log_callback, [PkgcraftLog.by_ref], :void
attach_function :pkgcraft_logging_enable, [:log_callback, LogLevel], :void
attach_function :pkgcraft_log_free, [:pointer], :void
attach_function :pkgcraft_log_test, [:string, LogLevel], :void
attach_function :pkgcraft_logging_enable, [:log_callback, LogLevel], :void
end

# Logging support
Expand Down
32 changes: 16 additions & 16 deletions lib/pkgcraft/pkg/ebuild.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@ module Pkgcraft
# FFI bindings for ebuild package related functionality
module C
# ebuild pkg support
attach_function :pkgcraft_pkg_ebuild_path, [Pkg], String
attach_function :pkgcraft_pkg_ebuild_ebuild, [Pkg], String
attach_function :pkgcraft_pkg_ebuild_description, [Pkg], String
attach_function :pkgcraft_pkg_ebuild_slot, [Pkg], String
attach_function :pkgcraft_pkg_ebuild_subslot, [Pkg], String
attach_function :pkgcraft_pkg_ebuild_long_description, [Pkg], String
attach_function :pkgcraft_pkg_ebuild_dependencies, [Pkg, :pointer, :size_t], :DependencySet
attach_function :pkgcraft_pkg_ebuild_depend, [Pkg], :DependencySet
attach_function :pkgcraft_pkg_ebuild_bdepend, [Pkg], :DependencySet
attach_function :pkgcraft_pkg_ebuild_defined_phases, [Pkg, LenPtr.by_ref], :pointer
attach_function :pkgcraft_pkg_ebuild_depend, [Pkg], :DependencySet
attach_function :pkgcraft_pkg_ebuild_dependencies, [Pkg, :pointer, :size_t], :DependencySet
attach_function :pkgcraft_pkg_ebuild_description, [Pkg], String
attach_function :pkgcraft_pkg_ebuild_ebuild, [Pkg], String
attach_function :pkgcraft_pkg_ebuild_homepage, [Pkg, LenPtr.by_ref], :pointer
attach_function :pkgcraft_pkg_ebuild_idepend, [Pkg], :DependencySet
attach_function :pkgcraft_pkg_ebuild_pdepend, [Pkg], :DependencySet
attach_function :pkgcraft_pkg_ebuild_rdepend, [Pkg], :DependencySet
attach_function :pkgcraft_pkg_ebuild_inherit, [Pkg, LenPtr.by_ref], :pointer
attach_function :pkgcraft_pkg_ebuild_inherited, [Pkg, LenPtr.by_ref], :pointer
attach_function :pkgcraft_pkg_ebuild_iuse, [Pkg, LenPtr.by_ref], :pointer
attach_function :pkgcraft_pkg_ebuild_keywords_str, [Pkg, LenPtr.by_ref], :pointer
attach_function :pkgcraft_pkg_ebuild_license, [Pkg], :DependencySet
attach_function :pkgcraft_pkg_ebuild_long_description, [Pkg], String
attach_function :pkgcraft_pkg_ebuild_path, [Pkg], String
attach_function :pkgcraft_pkg_ebuild_pdepend, [Pkg], :DependencySet
attach_function :pkgcraft_pkg_ebuild_properties, [Pkg], :DependencySet
attach_function :pkgcraft_pkg_ebuild_rdepend, [Pkg], :DependencySet
attach_function :pkgcraft_pkg_ebuild_required_use, [Pkg], :DependencySet
attach_function :pkgcraft_pkg_ebuild_restrict, [Pkg], :DependencySet
attach_function :pkgcraft_pkg_ebuild_slot, [Pkg], String
attach_function :pkgcraft_pkg_ebuild_src_uri, [Pkg], :DependencySet
attach_function :pkgcraft_pkg_ebuild_defined_phases, [Pkg, LenPtr.by_ref], :pointer
attach_function :pkgcraft_pkg_ebuild_homepage, [Pkg, LenPtr.by_ref], :pointer
attach_function :pkgcraft_pkg_ebuild_keywords_str, [Pkg, LenPtr.by_ref], :pointer
attach_function :pkgcraft_pkg_ebuild_iuse, [Pkg, LenPtr.by_ref], :pointer
attach_function :pkgcraft_pkg_ebuild_inherit, [Pkg, LenPtr.by_ref], :pointer
attach_function :pkgcraft_pkg_ebuild_inherited, [Pkg, LenPtr.by_ref], :pointer
attach_function :pkgcraft_pkg_ebuild_subslot, [Pkg], String
end

module Pkgs
Expand Down
20 changes: 10 additions & 10 deletions lib/pkgcraft/repo/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ module Pkgcraft
# FFI bindings for generic repo related functionality
module C
typedef :pointer, :repo
attach_function :pkgcraft_repo_categories, [:repo, LenPtr.by_ref], :pointer
attach_function :pkgcraft_repo_cmp, [:repo, :repo], :int
attach_function :pkgcraft_repo_contains_path, [:repo, :string], :bool
attach_function :pkgcraft_repo_format, [:repo], :int
attach_function :pkgcraft_repo_free, [:repo], :void
attach_function :pkgcraft_repo_from_path, [:string, :int, :string, :bool], :repo
attach_function :pkgcraft_repo_hash, [:repo], :uint64
attach_function :pkgcraft_repo_id, [:repo], String
attach_function :pkgcraft_repo_path, [:repo], String
attach_function :pkgcraft_repo_contains_path, [:repo, :string], :bool
attach_function :pkgcraft_repo_categories, [:repo, LenPtr.by_ref], :pointer
attach_function :pkgcraft_repo_packages, [:repo, :string, LenPtr.by_ref], :pointer
attach_function :pkgcraft_repo_versions, [:repo, :string, :string, LenPtr.by_ref], :pointer
attach_function :pkgcraft_repo_len, [:repo], :uint64
attach_function :pkgcraft_repo_is_empty, [:repo], :bool
attach_function :pkgcraft_repo_iter, [:repo], :pointer
attach_function :pkgcraft_repo_iter_cpv, [:repo], :pointer
attach_function :pkgcraft_repo_iter_cpv_free, [:pointer], :void
attach_function :pkgcraft_repo_iter_cpv_next, [:pointer], Pkgcraft::Dep::Cpv
attach_function :pkgcraft_repo_iter, [:repo], :pointer
attach_function :pkgcraft_repo_iter_free, [:pointer], :void
attach_function :pkgcraft_repo_iter_next, [:pointer], Pkgcraft::Pkgs::Pkg
attach_function :pkgcraft_repo_iter_restrict, [:repo, Restrict], :pointer
attach_function :pkgcraft_repo_iter_restrict_free, [:repo], :void
attach_function :pkgcraft_repo_iter_restrict_next, [:pointer], Pkgcraft::Pkgs::Pkg
attach_function :pkgcraft_repo_format, [:repo], :int
attach_function :pkgcraft_repo_free, [:repo], :void
attach_function :pkgcraft_repo_from_path, [:string, :int, :string, :bool], :repo
attach_function :pkgcraft_repo_len, [:repo], :uint64
attach_function :pkgcraft_repo_packages, [:repo, :string, LenPtr.by_ref], :pointer
attach_function :pkgcraft_repo_path, [:repo], String
attach_function :pkgcraft_repo_versions, [:repo, :string, :string, LenPtr.by_ref], :pointer
end

# Repo support
Expand Down
10 changes: 5 additions & 5 deletions lib/pkgcraft/repo/ebuild_temp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

module Pkgcraft
# FFI bindings for temporary ebuild repo related functionality
# rubocop:disable Layout/LineLength
module C
attach_function :pkgcraft_repo_ebuild_temp_create_ebuild, [:pointer, :string, :pointer, :uint64], String
attach_function :pkgcraft_repo_ebuild_temp_create_ebuild_raw, [:pointer, :string, :string], String
attach_function :pkgcraft_repo_ebuild_temp_free, [:pointer], :void
attach_function :pkgcraft_repo_ebuild_temp_new, [:string, :pointer], :pointer
attach_function :pkgcraft_repo_ebuild_temp_path, [:pointer], :string
attach_function :pkgcraft_repo_ebuild_temp_free, [:pointer], :void
attach_function \
:pkgcraft_repo_ebuild_temp_create_ebuild, [:pointer, :string, :pointer, :uint64], String
attach_function \
:pkgcraft_repo_ebuild_temp_create_ebuild_raw, [:pointer, :string, :string], String
end
# rubocop:enable Layout/LineLength

module Repos
# Temporary ebuild package repo.
Expand Down
2 changes: 1 addition & 1 deletion lib/pkgcraft/repo/fake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
module Pkgcraft
# FFI bindings for fake repo related functionality
module C
attach_function :pkgcraft_repo_fake_new, [:string, :int, :pointer, :size_t], :pointer
attach_function :pkgcraft_repo_fake_extend, [:repo, :pointer, :size_t], :repo
attach_function :pkgcraft_repo_fake_new, [:string, :int, :pointer, :size_t], :pointer
end

module Repos
Expand Down
Loading

0 comments on commit 272a309

Please sign in to comment.