Sha256: 1283943c5ce4df87fb752ca20d1d143aeae70aa77359d43d295d1a28e81216e7

Contents?: true

Size: 1.74 KB

Versions: 1

Compression:

Stored size: 1.74 KB

Contents

<% if header? %>
// <%= FFIDB.header %>

<% end %>
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.Structure.FFIType.size_t;
import com.sun.jna.platform.linux.XAttr.ssize_t;
<% for library in @libraries %>

public interface <%= library&.interface_name || :FFI %> extends Library {
<% if library && @functions[library] %>
  <%= library&.interface_name || :FFI %> INSTANCE = (<%= library&.interface_name || :FFI %>)Native.load("<%= dlopen_paths_for(library).first %>", <%= library&.interface_name || :FFI %>.class);
<% end %>
<% for enum in @enums[library] || [] %>

<% if enum.comment %>
  // <%= enum.comment %>
<% end %>
  public static class <%= enum.name %> {
  <% for name, value in enum.values || {} %>
    public static final int <%= name %> = <%= value %>;
  <% end %>
  }
<% end %>
<% for struct in @structs[library] || [] %>

  <% if struct.comment %>
  // <%= struct.comment %>
  <% end %>
  <% if struct.opaque? %>
  @FieldOrder({ "_opaque" })
  public static class <%= struct.name %> extends Structure {
    public byte _opaque;
  <% else %>
  @FieldOrder({ <%= (struct.fields || {}).keys.map(&:to_s).map(&:inspect).join(', ') %> })
  public static class <%= struct.name %> extends Structure {
  <% for name, type in struct.fields || {} %>
    public <%= struct_type(type) %> <%= name %>; // <%= type %>
  <% end %>
  <% end %>
  }
<% end %>
<% for function in @functions[library] || [] %>

  <% if function.comment %>
  // <%= function.comment %>
  <% end %>
  <%= param_type(function.type) %> <%= function.name %>(<%=
  function.parameters.each_value.map { |p| [param_type(p.type), p.name].join(' ') }.join(', ')
%>);
<% end %>
} // <%= library&.interface_name || :FFI %>
<% end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffidb-0.12.0 etc/templates/java.erb