View Source Unifex.Specs (Unifex v1.2.0)
Module that handles parsing Unifex specs for native boilerplate code generation.
For information on how to create such specs, see Unifex.Specs.DSL
module.
Summary
Types
Name of interface generated for the native library.
Must be a suffix of code generator module in Unifex.CodeGenerators
namespace.
Functions
Parses Unifex specs of native functions.
Types
@type interface_t() :: atom()
Name of interface generated for the native library.
Must be a suffix of code generator module in Unifex.CodeGenerators
namespace.
Unifex has built-in generators for NIF
and CNode
interfaces.
@type native_name_t() :: atom()
@type t() :: %Unifex.Specs{ callbacks: %{ required(hook :: :load | :upgrade | :unload | :main_function) => function_name :: String.t() }, dirty_functions: %{ required({function_name :: atom(), function_arity :: non_neg_integer()}) => :cpu | :io }, enums: [], functions_args: [ {function_name :: atom(), [arg_type :: {atom() | {:list, atom()}}]} ], functions_docs: [ {function_name :: atom(), documentation :: String.t() | false} ], functions_results: [{function_name :: atom(), return_type :: Macro.t()}], interface: [interface_t()] | interface_t() | nil, module: Unifex.CodeGenerator.t() | nil, name: native_name_t(), sends: [{send_name :: atom(), send_term_type :: Macro.t()}], state_type: String.t() | nil, structs: [struct_t()] }
Functions
@spec parse(specs_file :: String.t(), native_name_t()) :: t()
Parses Unifex specs of native functions.