Sha256: 8bfed06645276e5ff254ee3f7c5cc14fe79a36eff7fb51686564adf6cd2ddb18
Contents?: true
Size: 1.4 KB
Versions: 1
Compression:
Stored size: 1.4 KB
Contents
<% if header? %> # <%= FFIDB.header %> <% end %> require 'ffi' <% for library in @libraries %> module <%= options[:module] || library&.name&.capitalize || :FFI %> <% if library && @functions[library] %> extend FFI::Library ffi_lib [<%= dlopen_paths_for(library).map(&:inspect).join(', ') %>] <% end %> <% for enum in @enums[library] || [] %> <% if enum.comment %> <%= format_comment(enum.comment, ' #') %> <% end %> <%= enum.name %> = :int <% for name, value in enum.values || {} %> <%= name %> = <%= value %> <% end %> <% end %> <% for struct in @structs[library] || [] %> <% if struct.comment %> <%= format_comment(struct.comment, ' #') %> <% end %> <% if struct.opaque? %> <%= struct.name %> = :pointer <% else %> class <%= struct.name %> < FFI::Struct <% for (name, type), i in (struct.fields || {}).each_with_index %> <%= i.zero? ? 'layout' : ' '*6 %> :<%= name %>, <%= struct_type(type) %><%= (i == (struct.fields || {}).size-1) ? '' : ',' %> # <%= type %> <% end %> end <% end %> <% end %> <% for function in @functions[library] || [] %> <% if function.comment %> <%= format_comment(function.comment, ' #') %> <% end %> attach_function :<%= function.name %>, [<%= function.parameters.each_value.map { |param| param_type(param.type) }.join(', ') %>], <%= param_type(function.type) %> <% end %> end # <%= options[:module] || library&.name&.capitalize || :FFI %> <% end %>
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ffidb-0.13.0 | etc/templates/ruby.erb |